package controller

import java.sql.Connection
import java.util.Properties

import org.apache.spark.sql.SparkSession
import service.EmploymentStatusService

object EmploymentStatusController {
    def main(args: Array[String]): Unit = {
        val spark: SparkSession = SparkSession
          .builder()
          .master("local[*]")
          .appName("JDBCRead")
          .getOrCreate()

        // 专用的读
        val url1 = "jdbc:mysql://192.168.1.90:3306/cy_analysis_data"
        val url2 = "jdbc:mysql://192.168.1.90:3306/test"
        val table1 = "college_graduate"
        val table2 = "big_screen_result_copy1"

        val props: Properties = new Properties()
        props.setProperty("user", "root")
        props.setProperty("password", "bigData@123")

        //mysql的参数设置
        val url4 = "jdbc:mysql://192.168.1.90:3306/test"
        val user4 = "root"
        val password4 = "bigData@123"
        val props4: Properties = new Properties()
        props4.put("user", user4)
        props4.put("password", password4)
        props4.setProperty("useSSL", "false")
        props4.setProperty("useUnicode", "true")
        props4.setProperty("characterEncoding", "utf8")


        EmploymentStatusService.dataProcess(spark,url2,table1,props,url4,props4)






    }
}